# __author__ = 'l4537'
# !/usr/bin/env python
# -*- coding:utf-8 -*-
# coding:utf-8
import os,sys
import django
from pathlib import Path

# 根据根目录需求，添加parent，第一层加2个，依次添加
BASE_DIR = Path(__file__).resolve().parent.parent.parent
sys.path.append(str(BASE_DIR))
os.environ['DJANGO_SETTINGS_MODULE']='application.settings'
django.setup()

from script.utils.loger import log

from  dvadmin.knowledge.documents import BookDocument


s = BookDocument.search().filter("term",name="说")
qs = s.to_queryset()
print(s)
log.info(s)

for hit in s:
    log.info(hit.name)
    print(hit.name)

print(qs)
for hit in qs:
    print(hit.name)